#ifndef KEYTHREAD_H
#define KEYTHREAD_H

#include <QThread>
#include <QProcess>
#include <QDebug>

#include "config.h"

extern "C"{
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
}



enum Key_t
{
    KEY_NONE,
    KEY_PRESS,
    KEY_LONG_PRESS,
    KEY_RELEASE,
    KEY_REPEAT,
    KEY_CLICK,
};

class KeyThread : public QThread
{
    Q_OBJECT
public:
    static KeyThread *Get()
    {
        static KeyThread k;
        return &k;
    }

    explicit KeyThread();

    void run() override;

    void readKey_left(int &fd, bool &press, bool &pressLong, int &count, int key);
signals:
    void key_press(int );
    void keyEvent(Key_t, int);
};

#endif // KEYTHREAD_H
